package com.lenovo.smarttraffic.zm;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.lenovo.smarttraffic.R;
import com.lenovo.smarttraffic.ui.activity.BaseActivity;

import java.io.Serializable;


public class ParkActivity extends BaseActivity implements Serializable {
    private TextView name;
    private TextView address;
    private TextView zuiwei;
    private CarParkInfo.ROWSDETAILBean bean;
    private LinearLayout ll_address;

    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_park);
        Intent intent = this.getIntent();
        bean = (CarParkInfo.ROWSDETAILBean) intent.getSerializableExtra("bean");
        initView();
    }

    @Override
    protected int getLayout() {
        return R.layout.activity_park;
    }

    public void initView() {
        initToolBar(findViewById(R.id.toolbar), true, "停车场详情");
        name = (TextView) findViewById(R.id.name);
        name.setText("" + bean.getName());
        address = (TextView) findViewById(R.id.address);
        address.setText("" + bean.getAddress());
        zuiwei = (TextView) findViewById(R.id.zuiwei);
        zuiwei.setText(bean.getEmptyspace() + "/" + bean.getAllspace() + "\n剩余车位");

        ll_address = (LinearLayout) findViewById(R.id.ll_address);
        ll_address.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(ParkActivity.this, OffMapActivity.class);
                intent.putExtra("latLng",bean.getCoordinate());
                intent.putExtra("parkName",bean.getName());
                startActivity(intent);
            }
        });
    }
}
